<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2017/10/16
 * Time: 19:13
 */
class Printer{
    private static $obj=null;
    private function _construct(){

    }
   static function getInstance(){
        if(is_null(self::$obj)){
            self::$obj=new Printer();
        }
        return self::$obj;
    }
}

$p1=Printer::getInstance();

$p2=Printer::getInstance();
var_dump($p1);
var_Dump($p2);